<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>数组去重有哪些方法</title>
</head>

<body>
    <ol>
        <li>es6新增的set方法</li>
        <li>array reduce</li>
        <li>数组迭代</li>
    </ol>
</body>

</html>
<script>
    let arr = [1, 2, 4, 2, 5, 6, 1, 5];
    let newArr = arr.reduce((prev, next) => {
        prev.indexOf(next) === -1 && prev.push(next);
        return prev;
    }, []);
    console.log(newArr);
</script>